<?php echo $this->render('./includes/header.phtml');?>
<?php echo $this->render('./includes/fix_top_menu.phtml');?>
	<div id="container" class="row-fluid">
		<?php echo $this->render('./includes/menu.phtml');?>
		<div id="main-content">
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">
							Quản lí thành viên   <small></small>
						</h3>
					</div>
				</div>
							<div class="row-fluid">
					<div class="span12">
						<div class="widget">
							<div class="widget-title">
								<h4>
									<i class="icon-reorder"></i> Tổng số thành viên : <?php echo $this->total_user;?>
								</h4>
							</div>
							<div class="widget-body">
								<?php echo $this->render('./includes/display_alert_message.phtml');?>
								<table class="table table-striped table-bordered" id="sample_1">
									<thead>
										<tr>
											<th>Tên </th>
											<th class="hidden-phone">Email</th>
											<th class="hidden-phone">Ảnh avatar</th>
											<th class="hidden-phone">Ngày tham gia </th>
											<th class="hidden-phone"></th>
										</tr>
									</thead>
									<tbody>
									<?php 
									if(count($this->arrUser) != 0) {
									foreach ($this->arrUser as $user) {?>
										<tr class="odd gradeX">
											<td>
												<?php if($user['username'] != '') {?>
												<?php echo  ($user['username']); ?>
												<?php }?>
											</td>
											<td class="hidden-phone">
												<?php if($user['email'] != ''){?>
												<a href="mailto:<?php echo  $user['email']; ?>"><?php echo  $user['email']; ?></a>
												<?php }?>
											</td>
											<td class="hidden-phone">
												<?php if($user['profile_picture'] != '') {?>
												<div class="thumbnail" style="height: 50px; width: 50px;">
												<div class="item" style="height: 50px; width: 50px;">
													<a class="fancybox-button" data-rel="fancybox-button"
														title="" href="<?php echo $this->baseUrl(UPLOAD_PHOTO_DIRECTORY.$user['profile_picture']); ?>"><div
															class="zoom">
															<img alt="" src="<?php echo $this->baseUrl(UPLOAD_PHOTO_DIRECTORY.$user['profile_picture']); ?>" style="height: 50px; width: 50px;">
															<div class="zoom-icon" style="height: 50px; width: 50px;"></div>
														</div></a>
													</div>
												</div>
												<?php }?>
												
											</td>
											<td class="center hidden-phone">
												<?php if($user['created_time'] != ''){?>
												<?php echo  $user['created_time']; ?>
												<?php }?>
											</td>
											<td class="hidden-phone">
												<a href="#myModal<?php echo  $user['user_id']; ?>"
										role="button" class="btn btn-primary" data-toggle="modal">Chi tiết </a>
										<div id="myModal<?php echo  $user['user_id']; ?>" class="modal hide fade" tabindex="-1"
										role="dialog" aria-labelledby="myModalLabel<?php echo  $user['user_id']; ?>"
										aria-hidden="true">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"
												aria-hidden="true">×</button>
											<h3 id="myModalLabel2"><?php echo  ($user['username']); ?></h3>
										</div>
										<div class="modal-body">
											<?php if($user['fullname'] != '') {?>
											<p><span class="span3">Tên đầy đủ  : </span> <span class="span9"><?php echo ($user['fullname']); ?></span></p>
											<?php }?>
											<?php if($user['dob'] != '') {?>
											<p><span class="span3">Ngày sinh  : </span> <span class="span9"><?php echo  $user['dob']; ?></span></p>
											<?php }?>
											<?php if($user['sex'] != '') {?>
											<p><span class="span3">Giới tính  : </span><span class="span9"><?php if($user['sex'] == "F") { echo "Nữ "; } else if ($user['sex'] == "M") {echo "Nam ";} else {echo "Không xác định ";} ?></span></p>
											<?php }?>
											<?php if($user['profile_picture'] != '') {?>
											<p><span class="span3">Ảnh avatar : </span><span class="span9"><img alt="" src="<?php echo $this->baseUrl(UPLOAD_PHOTO_DIRECTORY.$user['profile_picture']); ?>" style="height: 170px; width: 150px;"></span></p>
											<?php }?>
											<?php if($user['address'] != '') {?>
											<p><span class="span3">Địa chỉ  : </span><span class="span9"><?php echo  ($user['address']); ?></span></p>
											<?php }?>
											<?php if($user['email'] != '') {?>
											<p><span class="span3">Email : </span><span class="span9"><?php echo  $user['email']; ?></span></p>
											<?php }?>
											<?php if($user['phone'] != '') {?>
											<p><span class="span3">Điện thoại  : </span><span class="span9"><?php echo  $user['phone']; ?></span></p>
											<?php }?>
											<?php if($user['last_login'] != '') {?>
											<p><span class="span3">Đăng nhập lần cuối  : </span><span class="span9"><?php echo  $user['last_login']; ?></span></p>
											<?php }?>
										</div>
										<div class="modal-footer">
											<button data-dismiss="modal" class="btn btn-primary">OK</button>
										</div>
									</div>
									<a href="<?php echo $this->baseUrl('/user/?delete=1&user_id='.$user['user_id']);?>" class="btn btn-danger" title="Xoá " onclick="return confirm('Xoá thành viên?');"> <i class="icon-trash"></i> Xoá </a>
									<?php if ($user['role'] == 1) {?>
												<a class="btn btn-info" title="Click to set user as memeber" href="<?php echo $this->baseUrl('/user/?role=0&user_id='.$user['user_id']);?>">Admin</a>
											<?php } else {?>
											<a class="btn btn-success" title="Click to set user as admin" href="<?php echo $this->baseUrl('/user/?role=1&user_id='.$user['user_id']);?>">Member</a>
											<?php }?>
												</td>
										</tr>
										<?php 
										}
										}?>
									</tbody>
								</table>
								<?php if(count($this->arrUser) != 0) {?>
 								<?php echo $this->paginationControl($this->arrUser, 'Sliding' , './includes/pagination.phtml'); ?>
 								<?php }?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php echo $this->render('./includes/footer.phtml');?>